/**
 * Description: CreditCard.java
 * All Rights Reserved.
 * @version 2.1  2013-12-6 下午2:35:18  by 李青原（liqingyuan1986@aliyun.com）创建
 */
package pojo;

import com.zuche.framework.annotation.IbatisAliasConfig;
import com.zuche.framework.tradingPlatform.CurrenceSource;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * 交易卡。可以是借记卡，也可以是贷记卡。
 * <br/> Created on 2013-12-6 下午2:35:18
 * @author  李青原(liqingyuan1986@aliyun.com)
 * @since 2.1
 */
@IbatisAliasConfig(alias="tradingCard")
public class TradingCard  implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 7332265871789751534L;

	private Long id;
	
	private String memberId;
	
	private String memberName;
	
	private String cardNo;
	
	private String cvv;
	
	private String expireYear;
	
	private String expireMonth;
	
	private String identityId;

    private Integer identityType;

	private String memberTel;
	
	private String sourceId;

	private Integer status;
	
	private String nationCode;

    private Integer cardType;

    private Boolean isNew;

    private Long oldId;
    /**
     * 流水号
     */
    private String recordId;
    /**
     * 明文卡号
     */
    private String cardNoDec;
    // 操作人类型
    private Integer operType;
    // 操作人
    private Integer modifyEmpId;
    


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMemberId() {
		return memberId;
	}

	public void setMemberId(String memberId) {
		this.memberId = memberId;
	}

	public String getMemberName() {
		return memberName;
	}

	public void setMemberName(String memberName) {
		this.memberName = memberName;
	}

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getCvv() {
		return cvv;
	}

	public void setCvv(String cvv) {
		this.cvv = cvv;
	}

	public String getExpireYear() {
		return expireYear;
	}

	public void setExpireYear(String expireYear) {
		this.expireYear = expireYear;
	}

	public String getExpireMonth() {
		return expireMonth;
	}

	public void setExpireMonth(String expireMonth) {
		this.expireMonth = expireMonth;
	}

	public String getIdentityId() {
		return identityId;
	}

	public void setIdentityId(String identityId) {
		this.identityId = identityId;
	}

	public String getMemberTel() {
		return memberTel;
	}

	public void setMemberTel(String memberTel) {
		this.memberTel = memberTel;
	}

	public String getSourceId() {
		return sourceId;
	}

	public void setSourceId(String sourceId) {
		this.sourceId = sourceId;
	}
	
	public String getNationCode() {
		return nationCode;
	}

	public void setNationCode(String nationCode) {
		this.nationCode = nationCode;
	}

    public Integer getCardType() {
        return cardType;
    }

    public void setCardType(Integer cardType) {
        this.cardType = cardType;
    }

    public Integer getIdentityType() {
        return identityType;
    }

    public void setIdentityType(Integer identityType) {
        this.identityType = identityType;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Boolean getIsNew() {
        return isNew;
    }

    public void setIsNew(Boolean isNew) {
        this.isNew = isNew;
    }

    public Long getOldId() {
        return oldId;
    }

    public void setOldId(Long oldId) {
        this.oldId = oldId;
    }

    /**
	 * 判断信用卡信息是否不完整,老的记录可能不完整.
	 * <br/> Created on 2013-12-19 下午4:46:46
	 * @author  李青原(liqingyuan1986@aliyun.com)
	 * @since 2.1
	 * @return
	 */
	public boolean isCompleteCredit(){
		return (cardType != null
                && 1 == cardType
                && StringUtils.isEmpty(this.cvv)
				&& StringUtils.isEmpty(this.expireYear)
                && StringUtils.isEmpty(this.expireMonth)
                && StringUtils.isEmpty(this.memberName)
                && StringUtils.isEmpty(this.memberTel)
                && StringUtils.isEmpty(this.identityId)
                && StringUtils.isEmpty(this.cardNo)
                && StringUtils.isEmpty(this.sourceId));
	}

    /**
     * 获得卡对象的安全副本，CVV 过期年月日 身份证件号码 被屏蔽
     * @return
     */
  /*  public TradingCard cloneSecurityCopy(){
//        TradingCard cardTemp = JSONObject.parseObject(JSONObject.toJSONString(this), TradingCard.class);
        cardTemp.setCvv(null);
        cardTemp.setExpireYear(null);
        cardTemp.setExpireMonth(null);
        cardTemp.setIdentityId(null);
        cardTemp.setIdentityType(null);
        cardTemp.setMemberTel(null);
//        cardTemp.setDesKey(null);
        return cardTemp;
    }*/

    /**
     * 获得资金来源名称
     * @return
     */
    public String getBankName() {
        return CurrenceSource.getSourceName(sourceId);
    }

//    public String getSecurityCardNo() {
//        return PlatformUtils.getHiddenCardId(cardNo, false);
//    }

    /*public String getCardTypeDesc() {
        if(cardType == null){
            return null;
        }
        return CardType.values()[cardType].getDesc();
    }*/

    public String getIsNewDesc() {
        if(isNew == null){
            return null;
        }
        return isNew ? "新模式":"旧模式";
    }

	public String getRecordId() {
		return recordId;
	}

	public void setRecordId(String recordId) {
		this.recordId = recordId;
	}

	public String getCardNoDec() {
		return cardNoDec;
	}

	public void setCardNoDec(String cardNoDec) {
		this.cardNoDec = cardNoDec;
	}

	public Integer getOperType() {
		return operType;
	}

	public void setOperType(Integer operType) {
		this.operType = operType;
	}

	public Integer getModifyEmpId() {
		return modifyEmpId;
	}

	public void setModifyEmpId(Integer modifyEmpId) {
		this.modifyEmpId = modifyEmpId;
	}
}
